# -*- coding: utf-8 -*-

import json


file_name ='movie_data_2label'
out_name = 'data_labeled'
data_json = []


def get_source():
    with open(file_name, "r") as f:
        file_contents = f.readlines()

    for content in file_contents:
        data_json.append(json.loads(content))
    return data_json


def save_data_labeled(data):
    with open(out_name, "a", encoding='utf-8') as f:
        for d in data:
            f.write(d+'\r')
        f.write('\r')


def update_source(data):
    with open(file_name, "w") as f:
        for d in data:
            f.write(json.dumps(d)+'\r')
